﻿@model DealKhuyenMaiV2.com.Models.Product
@using DealKhuyenMaiV2.com.Helpers

@{
    ViewBag.Title = "ShoppingCart";
}

<!DOCTYPE html>
<html>
    <head>
        <link href="@Url.Content("/Content/DefaultThemes/Styles/payment.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("/Content/DefaultThemes/Styles/login.css")" rel="stylesheet" type="text/css" />
        <script type = "text/javascript">
            $(document).ready(function () {

                var price = parseInt('@(Model.Price-Model.Discount)');
                var $htm = $("#select1").val() * price;
               $("#amount").val($htm/20);
               $("#totalnumber").val($("#select1").val());
               $("#total").val($htm);
                $("label[for='non']").text($htm + ".000");

                $("#select1").change(function () {

                    var $htm = $("#select1").val() * price;
                    $("#amount").val($htm / 20);
                    $("#totalnumber").val($("#select1").val());
                    $("#total").val($htm);
                    $("label[for='non']").text($htm + ".000");
                });
            });
            
        </script>
    </head>

<body>
    <div class="body-left">
        <!--Unknown-->
        <!-- UPD 27.10.3 -->
        <div class="middle-box-white">
            <div class="middle-box-title">
                <div class="left">
                    <h3>
                        <span class="middle-size">Đặt hàng</span>
                    </h3>
                </div>
                <div class="clear"></div>
            </div>
               
            <div class="middle-box-content">
                <div class="order">
                    <div class="table_order">
                        <table class="table_title">
                            <tbody>
                                <tr>
                                    <td class="product">
                                        <div class="title_pay"><span>Sản phẩm</span></div>
                                    </td>
                                    <td class="pri">
                                        <div class="title_pay"><span>Đơn giá</span></div>
                                    </td>
                                    <td class="num">
                                        <div class="title_pay"><span>Số lượng</span></div>
                                    </td>                    	                       
                                    <td class="price">
                                        <div class="title_pay"><span>Thành tiền</span></div>
                                    </td>    
                                </tr>
                            </tbody>
                        </table>
                        <div id="dvGioHang">
                            <table class="table_content">
                                <tbody>
                                    <tr>
                                        <td class="product">
                                            <div class="content">
                                                @Model.NameProduct
                                            </div>
                                        </td>
                                        <td class="pri">
                                            <div class="content">
                                                @(Model.Price - Model.Discount)
                                            </div>
                                        </td> 
                                        <td class="num">
                                            <div class="content">
                                                <select id="select1">
                                                    <option value="0">Chọn</option>
                                                    <option value="1" selected="selected">1</option>
                                                    <option value="2">2</option>
                                                    <option value="3">3</option>
                                                    <option value="4">4</option>
                                                    <option value="5">5</option>
                                                    <option value="6">6</option>
                                                    <option value="7">7</option>
                                                    <option value="8">8</option>
                                                    <option value="9">9</option>
                                                    <option value="10">10</option>
                                                </select>
                                            </div>
                                        </td>
                                        <td class="price">
                                            <div class="content">

                                               
                                                @Html.Label("non", (Model.Price - Model.Discount).ToString())
                                               
                                            </div> 
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="table_price"><span id="pTotal">Tổng số tiền: @Html.Label("non", (Model.Price - Model.Discount).ToString()) VNĐ</span></div>
                    </div>

                </div>
                @using (Html.BeginForm("DirectBuy", "Home", new { idProduct = Model.IDProduct }, FormMethod.Post, new { @name = "myform" }))
                {
                <p>
                    Địa chỉ người nhận:
                </p>
                <div class="div_txtDK">
                    <input name="TextDiaChi" type="text" />
                </div>
                
                <p>
                    Số điện thoại người nhận:
                </p>
                    <div class="div_txtDK">
                        <input name="TextDienThoai" type="text" />
                    </div>
                    <input type="hidden" id = "totalnumber" name="totalnumber"/>
                    <input type="hidden" id = "total" name="total"/>
                }
               
                <p class="middle-box-button">
                    Điều kiện giao hàng
                </p>
                
            </div>

        </div>
    
        <div class="box_pay_small">
            <h3>
                <span class="middle-size">Thanh toán bằng Paypal</span>
            </h3>
            <div class="clear"></div>

            <div class="inbox">
                <div class="center contentPadd" id="cartInfo" style="height: auto;">
                    <div class="LF">
                        <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
                            <input type="hidden" name="cmd" value="_xclick" />
                            <input type="hidden" name="upload" value="1" />
                            <input type="hidden" name="business" value="duongtrieu.lei@gmail.com" />
                        
                                                   
                             @*-----------Thay the 0.7 = tong so tien -------------*@             
                            <input id="amount" type="hidden" name="amount" value= ""  />
                            <input type="hidden" name="item_name" value="@Model.NameProduct.RemoveVietnameseSign()" />

                        
                 
                            @*<input type="hidden" name="currency_code" value="USD">*@
                            <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                            <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
                        </form>


                    </div>
                </div>
            </div>
        </div>
        <div style="width: 20px; float: left">
            <img src="/Content/DefaultThemes/Images/space.gif" width="20px" height="20px">
        </div>
        <div class="box_pay_small">
            <h3>
                <span class="middle-size">Thanh toán bằng khi nhận phiếu/sản phẩm</span>
            </h3>
            
             <div style="height: 50px">
                <input  class ="button_cam" type="submit" value="Xác nhận" onclick="document.myform.submit();"><//>
            </div>   
        </div>
</div>
</body>

</html>
